package org.wxd.category.api.dto;

import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;
import java.util.Map;

/**
 * Created by wangxd on 2015/11/14.
 */
public class CategoryRecord implements Serializable {
    private static final long serialVersionUID = 4496853630609786774L;

    private String id;
    private String name;
    private String pId;
    private Map<String,String> moreInfo;
    CategoryRecord(){}
    CategoryRecord(Builder builder){
        this.id = builder.id;
        this.name = builder.name;
        this.pId = builder.pId;
        this.moreInfo = builder.moreInfo;
    }


    public String id() {
        return id;
    }

    public String name() {
        return name;
    }

    public String pId() {
        return pId;
    }

    public Map<String, String> moreInfo() {
        return moreInfo;
    }

    public static Builder newBuilder(){
        return new Builder();
    }
    public static class Builder{
        String id;
        String name;
        String pId;
        Map<String, String> moreInfo;

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder pId(String pId) {
            this.pId = pId;
            return this;
        }

        public Builder moreInfo(Map<String, String> moreInfo) {
            this.moreInfo = moreInfo;
            return this;
        }

        public CategoryRecord build(){
            return new CategoryRecord(this);
        }
    }
    @Override
    public String toString(){
        return ToStringBuilder.reflectionToString(this);
    }
}
